
<html>
     <script type="text/javascript">
         function isNumberKey(evt)
      {
         var charCode = (evt.which) ? evt.which : event.keyCode
         if (charCode > 31 && (charCode < 48 || charCode > 57))
            return false;

         return true;
      }
            
var counter= new Array;
var gradenume=0;

function addInput1stQuarter(id,num,gradenum,n)
{      
       if(gradenum!=gradenume)
        {
            gradenume=gradenum;
            if(num>counter[gradenume]||counter[gradenume]==null)
            counter[gradenume]=num;
        }
      
        var x = document.getElementById("grade"+gradenume);
        var p = document.createElement("p");
      
	p.innerHTML= n+" "+counter[gradenume]+":";
        var input = document.createElement("input");
        //onkeypress='return isNumberKey(event)' 
        //maxlength='3'
        input.setAttribute("onkeypress",'return isNumberKey(event)');
        input.setAttribute("maxlength",'3' );
        input.setAttribute("class", 'tf_effect');
	input.setAttribute("style", 'padding:0;');
        input.setAttribute("type", 'text');
        input.setAttribute("name", 'newgrades['+id+'][]');
     
        
       
        x.appendChild(p);
        x.appendChild(input);
        counter[gradenume]++;
}
function deleteinput(gradenum)
{      
    if(gradenum!=gradenume)
        {
            gradenume=gradenum;
        }
      
        var x = document.getElementById("grade"+gradenume);
        //element.removeChild(element.firstChild)
        x.removeChild(x.lastChild);
        x.removeChild(x.lastChild);
        counter[gradenume]--;
      
}

</script>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
		<title>Grade Bay</title>
		<link rel="stylesheet" href="gui.css" type="text/css" />
		<!--[if IE 7]>
			<link rel="stylesheet" href="css/ie7.css" type="text/css" />
		<![endif]-->
	</head>
	<body onload="onload()">
		<div class="page">
			<div class="header">
				<a href="index.php" id="logo"><img src="images/gradeBaylogo.png" width="330" height="79" alt=""/></a>
				<ul>
					<li class="selected"><a href="">INPUT STUDENT GRADES</a></li>
                                        <?php
                                        echo "<li><a href='viewStudentProfile.php?studentID=".$_GET['studentID']."'>BACK</a></li>";
                                        ?>
				</ul>
			</div>
			<div class="body">
                            

                                    <?php
                                             include 'PHPClasses/DBAccess.php';
                                             include 'PHPClasses/StudentDBAccess.php';
                                             
                                              if(!isset($_GET['error'])){
                                                $_GET['error']=0;
                                                
                                                }

                                            if ($_GET['error']){ //If any errors display them  

                                                $errormsg = $_GET['error'] . ".<br>";
                                                echo "<p style='color:red;'>$errormsg</p>";
                                                   
                                            }
                                            if(!isset($_POST["subjectID"])||!isset($_POST["studentID"])){
                                                $subjectID=$_GET["subjectID"];
                                                $studID=$_GET["studentID"];
                                            }
                                            else
                                            {
                                                $subjectID=$_POST["subjectID"];
                                                $studID=$_POST["studentID"];
                                            }
                                               
                                       
                                            $DBAccess = new StudentDBAccess();
                                            $DBAccess ->listgrade($subjectID, $studID);
                                           
                                          
                    ?>
                         
                        </div>
                    
			<div class="footer">
				
				<p>&#169; Copyright &#169; 2011. Company name all rights reserved</p>
				<div class="connect">
					<a href=""><img src="images/paragox.png" width=160" height="110" alt=""/></a>
					<a href=""><img src="images/fblogo.png" width=120" height="100" alt="" style="position:relative; left:-31px"/></a>
					<a href=""><img src="images/harmony.png" width=120" height="100" alt="" style="position:relative; left:0px"/></a>
				</div>
			</div>
		</div>
	</body>
</html> 